-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
We now have to deal with the nonlinearity of the splines impl for Quat, though.
Be sure to merge my 0.3 update for this! I'll happily merge it when it's done |
I can't explain why the CI is failing - neither of us wrote that. |
@@ -11,7 +10,7 @@ pub enum LoopStyle { | |||
pub trait SplineGroup { | |||
type Sample; | |||
|
|||
fn splines(&self) -> Vec<&Spline<f32, f32>>; | |||
fn spline_key_times(&self) -> Vec<Box<dyn DoubleEndedIterator<Item = f32> + '_>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I think we should leave the
splines
function available for general use alongside your newspline_key_times
function, rather than replacing it. -
Dunno about returning a
Vec
containing arbitrary iterators. Consider adding anothertype
to theSplineGroup
trait instead?
pub trait SplineGroup {
type Sample;
type KeyTimes;
fn spline_key_times(&self) -> KeyTimes;
// ...
}
impl SplineGroup for AnimationSplineOne {
type Sample = Option<f32>;
type KeyTimes = Box<dyn DoubleEndedIterator<Item = f32> + '_>;
// ...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is, there can no longer be an fn splines(&self) -> Vec<&Spline<f32, f32>>
on SplineGroup, since not all splines have f32 values - one of them has Quats instead. So I looked around to see what the splines method was used for internally, replaced it with spline_key_times, and didn't really think too hard about how people might want to use it in general. I kind of assumed that it was just a side effect of needing to use it internally, and not having private trait methods. What's the use case?
I was absolutely not pleased with returning a Vec<Box<dyn Iterator>>
, but I just wanted to get a proof of concept working. Now that you've brought it back to my attention, I would like to look into if there's a better way to implement start_time, end_time and is_empty on SplineGroup, which to my knowledge are the only things spline_key_times is used for. Maybe we could just leave them as required methods, instead of trying to create a general default implementation that will probably end up needing dynamic dispatch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is, there can no longer be an fn splines(&self) -> Vec<&Spline<f32, f32>> on SplineGroup, since not all splines have f32 values - one of them has Quats instead.
Ah, true that.
What's the use case?
main one I thought of is that if this is eventually integrated into a UI, you'd want direct access to the splines for drawing them in a curve editor.
Maybe we could just leave them as required methods, instead of trying to create a general default implementation that will probably end up needing dynamic dispatch?
Seems like a good option. Feel free to experiment.
It's worth mentioning that there's Another PR doing animation that uses property names and just seems overall more flexible than the hard-typed implementation we're doing here. It might be a better option entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's worth mentioning that there's Another PR doing animation that uses property names and just seems overall more flexible than the hard-typed implementation we're doing here. It might be a better option entirely.
Wow, I hadn't seen that. I'm looking through it now, trying to understand what they're doing.
The failing CI is due to a new clippy warning that they have already suppressed in master. It will go away on its own after merging. |
This is what I have so far. The
Rotation
shim is exposed to the public API, which isn't super desirable, but it shows the functionality, at least.